home *** CD-ROM | disk | FTP | other *** search
/ BBS Toolkit / BBS Toolkit.iso / rbbs_pc / 172anew.zip / MACROS.DOC < prev    next >
Text File  |  1989-05-23  |  13KB  |  354 lines

  1. Documentation for Macros
  2. by Ken Goosens 24 May 1989
  3.  
  4. Macros have been enhanced in RBBS 17.2A from being a useful
  5. way to store multiple commands and attach a word to a string
  6. of commands, to being one of the most powerful features in
  7. RBBS.  They now work properly whether caller has turbo key on or off,
  8. can have unlimited length, can be invoked anywhere, have been
  9. integrated into questionnaires, support graphics versions,
  10. support SmartText and Work Variables, and, most importantly, have an
  11. entire new class of macro commands which give the sysop new
  12. control and power.
  13.  
  14.  
  15.                How Macros Are Processed
  16.  
  17. An entire macro was stacked into memory and executed.  Now,
  18. the macro is read from file a line at a time and processed,
  19. allowing macros to be as large as files can be, and making
  20. macros work properly even for caller with turbo key on.
  21.  
  22. Before, macros would only be executed a command line prompt.
  23. Now, macros can be executed from any prompt.   However, there
  24. are a few new restrictions of macros.  1st, a macro will be
  25. ignored if its name is the name of any command.  For example,
  26. macro "A" would be ignored because of the A)nswer questionnaire
  27. command.   (You must reassign "A" for a command if you want to
  28. use it as a macro.)  2nd, the prompt for More and file directories
  29. will not accept any macro with a single letter name.  Prompts for
  30. text to search and replace likewise should not support macros.
  31.  
  32.  
  33.                  Macros and Questionnairs
  34.  
  35. Macros can also be invoked from inside questionnaires using
  36. the new "M" command.  Control returns to the questionnaire
  37. when the macro is finished.  E.g. "M GETANS" inside a
  38. questionnaire will execute the macro called GETANS.
  39.  
  40. The questionnaire command to get a response has also been
  41. enhanced to allow the response to a questionnaire to be
  42. stored in a specified work varible.  E.g. 
  43.  
  44.             ?9 Please enter your dept
  45.  
  46. will store the answer in work variable 9.   The variable number
  47. must occur immediately after the "?".  Work variable n can
  48. then be referenced in macros using "[n]", e.g. "[9]".
  49. Questionnaires can thus collect values for subsequent
  50. macro processing.  The answer is still stored in the questionnaire
  51. the same as before.
  52.  
  53. Questionnaire lines that display text also now support metavariable
  54. substitution, both work variables and SmartText.
  55.  
  56. Macros have the capability to store data values in any format
  57. desired.  So one application for of macros inside questionnaires
  58. is to save the results in a different format.
  59.  
  60.  
  61.                      Macro Commands
  62.  
  63. 17.2A adds a new category of macro processing:  macro commands,
  64. which are commands executed in the macro rather than simply
  65. passed to RBBS as keystrokes that are typed in.   The macro
  66. commands include:
  67.  
  68. o   display a line with no carriage return
  69.  
  70. o   display a line with carriage return
  71.  
  72. o   display a block of lines
  73.  
  74. o   display a file
  75.  
  76. o   prompt for a response and store answer
  77.  
  78. o   pause a specified # of seconds
  79.  
  80. o   stack keystrokes
  81.  
  82. o   append a block of lines to a file.
  83.  
  84. o   control whether the macro text is echoed or not
  85.  
  86. o   retrieve values from a file into a form which is the displayed
  87.  
  88. In all prompts and blocks, substitution is supported for both
  89.  
  90. o   stored answers
  91.  
  92. o   SmartText variables.
  93.  
  94.  
  95.                  New Types of Applications Possible
  96.  
  97. (1)   Interactive help.  For example, you can put up a macro
  98.       called EZDOWN to help people download.   It explains everything,
  99.       asks for the file name and protocol, and tells the caller what they
  100.       should be doing on their end, then drives the download.
  101.  
  102. (2)   Data Base.  Unlike questionnaires, you can totally control
  103.       how data is written to a file.   You can put in labels, or data
  104.       only, put the values in quotes, separate the values by commas, etc.
  105.       Done by writing to file.   A block of text functions like a template
  106.       into which data values are substituted.
  107.  
  108. (3)   Tours of the board can be given, to showcase new or special
  109.       features.
  110.  
  111.  
  112.                         How to Write Macros
  113.  
  114. The configuration program specified the drive/path macros are stored
  115. on and what extension they have.  Macros are invoked using their
  116. name as prefix.   The default drive/path is C: and the default
  117. extension is "MCR".
  118.  
  119. All macros begin with a minimum security to use the macro, which should
  120. be an integer on the first line.
  121.  
  122. Macro commands have the same structure as SmartText variables:
  123.  
  124.            <command prefix><command name>
  125.  
  126. where <command prefix> is the SmartText command specified in CONFIG.
  127. The symbol "{" (ascii 123) is the default.   The <command name> consists
  128. of two characters.   Lines that are not valid macro commands are simply
  129. passed to RBBS as if the user had typed them in.   There are three
  130. differences between SmartText variables and macro commands:
  131.  
  132. (1)   Macro commands must be the first three characters on a line,
  133.       whereas SmartText variables can occur anywhere on a line.
  134.  
  135. (2)   Macro commands can have an argument after the command name, and
  136.  
  137. (3)   A macro command can apply to a block of lines following it.
  138.  
  139. The supported command names are:
  140.  
  141. *0 - display what follows on the line with no carriage return.  E.g.
  142.  
  143.             {*0Press any key to continue
  144.  
  145. *1 - display what follows on the line with a carriage return.  E.g.
  146.  
  147.          {*1{FN, I hope you enjoyed your tour of the board!
  148.  
  149.      This will substitute the first name of the caller for the
  150.      SmartText variable "{FN".
  151.  
  152. *B - display what follows on subsequent lines, each line with a
  153.      carriage return, up to the line beginning with "{END".  E.g.
  154.  
  155.         {*B
  156.         Macro commands have the ability to display
  157.         multiple lines.  The macro command is
  158.                      {*B
  159.         and it will display all lines until it encounters
  160.         one beginning with {END.  Like it, {FN?
  161.         {END
  162.  
  163.      The caller will seen everything between the first and last
  164.      lines, with the first name substituted into the last line
  165.      displayed.
  166.  
  167. *F - display the named file that follows.  E.g.
  168.  
  169.          {*F L:\RBBS\HELP.LST
  170.  
  171.      will display the file HELP.LST.
  172.  
  173. nn - use the text that follows on the line as a prompt and store
  174.      the resultant answer in an internal working variable numbered nn.
  175.      nn must be two digits and can be 01, 02, 03, ..., 30.  E.g.
  176.  
  177.          {01Please enter the Department you work for:
  178.          {02Pease enter your Office number:
  179.  
  180.      This will store the answers in work variable # 1 and 2, which
  181.      can be subsequently referenced as "[1]" and "[2]".
  182.  
  183.     Note:  you can have at most 30 referenced variables at a time.
  184.     Variables can be reused but the value gets overwritten.
  185.  
  186. WT - pause for the number of seconds specified after "WT".  E.g.
  187.  
  188.             {WT 2
  189.  
  190.      will wait for 2 seconds.
  191.  
  192. >> - append the following block of text to the file specified on this
  193.      line.  E.g.
  194.  
  195.               {>> C:MARCRO.DAT
  196.               "{FN","{LN","[1]","[2]"
  197.               {END
  198.  
  199.      will append the following line to the file named MACRO.DAT on
  200.      drive C:, assuming the caller is KEN GOOSENS, and he responded
  201.      to the above prompts for Department with "Controller" and Office #
  202.      with "107".   Then the line what would be written out is:
  203.  
  204.               "KEN","GOOSENS","Controller","107"
  205.  
  206.      Note that as many lines can be included as desired.  Simply end
  207.      the block to be written out with "{END" as the beginning of the
  208.      line.
  209.  
  210.      Some data base managers want fixed length files and this
  211.      is possible in the macro append.  Just add "/FL" on the
  212.      macro command line.  Rather than replace, the
  213.      substitution will overlay the line at the "[", thus keeping
  214.      the output fixed length.  E.g. suppose 1st work variable
  215.      has "A" as value and 2nd is "123456" and 3rd is "Henry",
  216.      and the caller's first name is KEN.
  217.      Then
  218.  
  219.             {>> C:\RBBS\DAT.FIL /FL
  220.             [1][2]....[3]...............{FN........
  221.             {END
  222.  
  223.      would add the following line into DAT.FIL
  224.  
  225.             A  123456.Henry.............KEN.........
  226.  
  227.      Normally, blanks would be put where dots are show.
  228.  
  229. ST - Stack the characters immediately following the "ST".  E.g.
  230.  
  231.                 {ST
  232.  
  233.      will stack a carriage return (no characters).  And
  234.     
  235.                 {STD [1] [2]
  236.  
  237.      would stack "D RBBS-EXE.ARC Z" - as if they were typed and
  238.      Enter pressed - if the 1st work variable has
  239.      "RBBS-PC.EXE" and the second work variable stores "Z".
  240.  
  241.      Realize that if you use macros to display text at an RBBS 
  242.      prompt like "Enter command? ", RBBS will continue to sit there
  243.      waiting for an answer.  A stacked carriage return at the end
  244.      will cause the prompt to be redisplayed, though the effect of
  245.      the stack will vary with the particular prompt.
  246.  
  247. M! - Execute the named macro that follows on the same line.  E.g.
  248.  
  249.                  {M! ORDER
  250.  
  251.      will execute the macro called ORDER.  The executes are
  252.      like "go to's" in that execution in the current macro ceases and
  253.      does not return automatically when ORDER is done.  Note that
  254.      the macro name is used (i.e. only the file prefix) and not
  255.      the full file name.
  256.  
  257. ON - Case logic for macros.  Depends on value of work variable
  258.      selected on the same line.  E.g.
  259.  
  260.              {ON 1
  261.              =A
  262.              M! D:\HIDDEN\CHOICEA.MCR
  263.              =B
  264.              {*1You have selected option B
  265.              {02Why did you select B?
  266.              =C
  267.              M! D:\HIDDEN\CHOICEA.MCR
  268.              {END ON
  269.  
  270.      Note:  the macro name can have a drive/path and/or extension.
  271.      If only a prefix is put in, RBBS will automatically add the
  272.      configuration drive/path and extension for macros.  But by
  273.      putting in a different drive/path/extension from config's you
  274.      can assure that a user cannot invoke the macro - if you want
  275.      it to be used only internally by your application.
  276.  
  277.  EY - Echo the text passed in macros as if keystrokes.   The default
  278.       is to echo.
  279.  
  280.  EN - Do not echo the macro keystrokes.  E.g.
  281.  
  282.         {EN
  283.         {*1 The following commands will be executed but now shown
  284.         {01 Press Enter when ready
  285.         R L
  286.         A
  287.         {EY
  288.         {*1 Same commands but now you will see the responses to the prompts
  289.         {01 Press Enter when ready
  290.         R L
  291.         A
  292.  << - Display fields from a file in a form.   This is one of the most
  293.       powerful new commands in macros, which allows data to be stored in
  294.       compact, data format but retrieved into a form for display to a
  295.       caller.    There are 5 parameters that can follow the macro command:
  296.  
  297.            <file name>  <file format> <data#> <submode> <rec-pause>
  298.  
  299.       where "<file name>" is the name of the data file that has records
  300.       to read, "<file format>" is "/V" if data is stored in variable
  301.       length format and "/F" if fixed length format.  "<data#>" is the
  302.       number of separate fields in a record for variable length data
  303.       and the length of the data if fixed length.  "<submode>" means
  304.       the mode by which data is substituted into the form that follows.
  305.       Put "/FL" if the form is fixed length, meaning that data is overlaid
  306.       into the form so as not to change any lengths.  Finally, "<rec-pause>"
  307.       should be "/1" if you want to pause after each record rather than
  308.       when the screen fills.
  309.  
  310. {*1 -TOPIC-    - DATA # -       - VOICE # -    -First Name-    -Last Name-
  311. {<< C:\RBBS\RHLP.DAT /V 5 /FL
  312. [1]         [2]              [3]             [5]             [4]
  313. {END
  314.  
  315. Note that spaces occur after the "[4]".  If the file RHLP.DAT contains
  316.  
  317. "DOORS","404-981-7781","405-988-7782","Wizard","The"
  318. "PROTOCOLS","709-123-4567","0","Horse","Crazy"
  319.  
  320. then the caller would see
  321.  
  322.  -TOPIC-    - DATA # -       - VOICE # -    -First Name-    -Last Name-
  323. DOORS       404-981-7781     405-988-7782    The             Wizard
  324. PROTOCOLS   709-123-4567     0               Crazy           Horse
  325.  
  326. The same example using fixed length data would be
  327.  
  328. {*1 -TOPIC-    - DATA # -       - VOICE # -    - Name -
  329. {<< C:\RBBS\RFLH.DAT /F 69 /FL
  330. [1](34:12)    [1](46:12)       [1](58:12)      [1](1:33)               
  331. {END
  332.  
  333. where RFLH.DAT contains:
  334.  
  335. The Wizard                       DOORS       404-981-7781405-988-7782
  336. Crazy Horse                      PROTOCOLS   709-123-45670           
  337.  
  338. This would produce the following for the caller:
  339.  
  340.  -TOPIC-    - DATA # -       - VOICE # -    - Name -
  341. DOORS       404-981-7781     405-988-7782    The Wizard
  342. PROTOCOLS   709-123-4567     0               Crazy Horse
  343.  
  344. Note that work fields support sub-field references in the format:
  345.  
  346.          [n](x:y)
  347.  
  348. where n is the work field number, x is the beginning column, and
  349. y is the # of bytes to get.  E.g. if work field 3 has value
  350. "123abc" then "[3](3:3)" would have "3ab" as its value.
  351. Fixed length records are always referenced as work variable 1.
  352.  
  353. For detailed applications of macros, see RDB.DOC.
  354.